An Introduction To Attribute Grammars

نویسنده

  • Sven Karol
چکیده

Beside the syntax, semantic is a very important part of programming languages. Without a semantic a program would no longer be a program but a lifeless sequence of characters which is part of the language. The dynamic semantic properties of a program are determined during execution at runtime. Typically they directly depend on the input values of the program. By contrast the static semantic properties of a program are computed at compile-time when it is translated from source code representation into some kind of goal representation. The static semantic of a programming language is used to determine those properties. The concept of attributed context-free grammars (Attribute Grammars) addresses this aspect. It enables a user to create complete specifications of static semantics. This article gives a short introduction on the topic of attributed context-free grammars. It shows how to define such a construct and introduces the concept of synthesised and inherited attributes which can be associated to grammar symbols. Furthermore it will be shown how semantic rules on attributes can be defined. The final part of the paper gives an introduction into different types of attribute grammars and attribute evaluators.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

An Introductory Tutorial on JastAdd Attribute Grammars

JastAdd is an open-source system for generating compilers and other language-based tools. Its declarative specification language is based on reference attribute grammars and object-orientation. This allows tools to be implemented as composable extensible modules, as exemplified by JastAddJ, a complete extensible Java compiler. This tutorial gives an introduction to JastAdd and its core attribut...

متن کامل

Object - Oriented Attribute Grammars

This paper introduces object-oriented attribute grammars. These can be characterized as a notation for all classes of attribute grammars. Based on a subtype relation between grammar rules, inheritance of attributes and attribute computations are defined. With this approach, attributes local to grammar rules and the elimination of chain rules are possible without any special constructs. We prese...

متن کامل

Can we transform logic programs into attribute grammars?

In this paper we study the relationship between Attribute Grammars and Logic Programs, concentrating on transforming logic programs into attribute grammars. This has potential applications in compilation techniques for logic programs. It does not seem possible to transform arbitrary Logic Programs into Attribute Grammars, basically because the same logic variables can sometimes be used as input...

متن کامل

Using Attribute Grammars to Derive Eecient Functional Programs

Two mappings from attribute grammars to lazy functional programs are deened. One of these mappings is an eecient implementation of attribute grammars. The other mapping yields ineecient programs. It is shown how some transformations of functional programs may be better understood by viewing the programs as ineecient implementations of attribute grammars.

متن کامل

Passes and Paths of Attributive Grammars

An attribute grammar is pure (left-to-right) multi-pass if a bounded number of left-to-right passes over the derivation tree suffice to compute all its attributes. There is no requirement, as for the usual multi-pass attribute grammars, that all occurrences of the same attribute are computed in the same pass, R is shown that the problem of determining whether an arbitrary attribute grammar is p...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2006